/**
 * @Copyright (c) 2017, 家校通信息科技有限公司 All Rights Reserved.
 */
package com.school.teaching.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.school.teaching.dto.PermissionQueryDTO;
import com.school.teaching.entity.Permission;
import com.school.teaching.service.IPermissionService;

/**
 * @Description TODO
 * @Author hesheng
 * @Date 2017年3月14日 下午3:38:57
 */
@RestController
@RequestMapping("/permission")
public class PermissionController {
	
	@Autowired
	private IPermissionService permissionService;

	@RequestMapping(value = "/all", method = RequestMethod.GET)
	public List<Permission> queryAll() {
		return permissionService.queryAll(null);
	}
	
	@RequestMapping(value = "/query/{userId}", method = RequestMethod.GET)
	public List<Permission> queryPermissions(@PathVariable String userId) {
		PermissionQueryDTO param = new PermissionQueryDTO();
		param.setUserId(userId);
		return permissionService.queryPermissions(param);
	}
}
